<template>
    <div>
        <h1>我的</h1>
        <input type="text">
        <button @click="getCode()">{{computeTime>0 ? '已发送'+'('+computeTime+')' : '获取验证码'}}</button>
    </div>
</template>

<script>
  export default {
    name: "Profile",
    data(){
      return{
        computeTime:0
      }
    },
    methods:{
      getCode(){
        this.computeTime = 30
        const setintevalID = setInterval(()=>{
          this.computeTime--
          if (this.computeTime<=0){
            clearInterval(setintevalID)
          }
        },1000)
      }
    }
  }
</script>

<style scoped>

</style>
